

# 13. 求s=a+aa+aaa+aaaa+aa...a的值，其中a是一个数字。例如2+22+222+2222+22222(此时共有5个数相加)，几个数相加由键盘控制。
"""
a = 2
循环的次数 ： i
temp = 0
2 =  2 * 10 ** 0 + temp
22 = 2 * 10 **1  + (2 * 10 ** 0)
222 = 2 * 10 ** 2 + (2 * 10 + 2)
2222 = 2 * 10 ** 3 + (2 * 100 + (2 * 10 + 2))

# 规律
aaaaa = a * 10 * i + temp
temp = a * 10 * i + temp
sum = sum + temp
"""
a = 2
i = input("请输入一个数字:")
i = int(i)
sum,temp = 0,0
for x in range(i):
    temp += a * 10 ** x        # a = a + 2 == > a += 2
    # print(temp)
    sum += temp

print(sum)


# 14. 题目：打印出如下图案（菱形）:
for x in range(1,5):
    space = (4 - x) * " "
    star = (2*x - 1) * "*"
    print(space + star)
for y in range(1,4):
    space = y * " "
    star = (7 -2*y) * "*"
    print(space + star)
